package com.ean.backpack.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ean.backpack.domain.Hotelimagelist;
import com.ean.backpack.repository.HotelimagelistRepository;
import com.ean.backpack.service.HotelimagelistService;

@Service
@Transactional
public class HotelimagelistServiceImpl implements HotelimagelistService {

	@Autowired
	HotelimagelistRepository hotelimagelistRepository;

	public long countAllHotelimagelists() {
		return hotelimagelistRepository.count();
	}

	public void deleteHotelimagelist(Hotelimagelist hotelimagelist) {
		hotelimagelistRepository.delete(hotelimagelist);
	}

	public List<Hotelimagelist> findAllByEANHotelID(Integer EANHotelID){
		return hotelimagelistRepository.findByEanhotelId(EANHotelID);
	}

	public List<Hotelimagelist> findAllHotelimagelists() {
		return hotelimagelistRepository.findAll();
	}

	public List<Hotelimagelist> findHotelimagelistEntries(int firstResult,
			int maxResults) {
		return hotelimagelistRepository.findAll(
				new org.springframework.data.domain.PageRequest(firstResult
						/ maxResults, maxResults)).getContent();
	}

	public void saveHotelimagelist(Hotelimagelist hotelimagelist) {
		hotelimagelistRepository.save(hotelimagelist);
	}

	public Hotelimagelist updateHotelimagelist(Hotelimagelist hotelimagelist) {
		return hotelimagelistRepository.save(hotelimagelist);
	}
}
